<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/restrito/layout/template.xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:define name="content">
        
        <h:form>
            
            <p>
            <ui:insert name="content">
                
            </ui:insert>
            </p>   
            
            <p align="center">
                
                <rich:dataTable value="#{mensagemController.listarTodas()}" var="mensagem" id="table" rows="20" rowClasses="odd-row, even-row"
            styleClass="stable">
                    
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Texto"/>
                        </f:facet>
                        <h:outputText value="#{mensagem.texto}"/>
                    </rich:column>
                    
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Data"/>
                                
                                
                        </f:facet>
                        
                        <h:outputText value="#{mensagem.data}">
                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                        </h:outputText>
                            
                         
                    </rich:column>
                    
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Hora"/>
                        </f:facet>
                        <h:outputText value="#{mensagem.hora}"/>
                    </rich:column>
                
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Status"/>
                        </f:facet>
                        <h:outputText value="#{mensagem.status}"/>
                    </rich:column>
                        
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Excluir"/>
                        </f:facet>
                        <h:commandButton value="Excluir" action="#{mensagemController.removerRecebidas()}"/>
                    </rich:column>
                    
                
                </rich:dataTable>
            
            <h:commandButton action="cadastrarMensagem" value="Nova Mensagem"/>
            
            </p>
            
        </h:form>
    </ui:define>
    
    <rich:jQuery selector=".stable tr:odd" query="addClass('odd-row')" />
    <rich:jQuery selector=".stable tr:even" query="addClass('even-row')" />
    <rich:jQuery selector=".stable tr" event="mouseover"
                 query="jQuery(this).addClass('active-row')"/>
    <rich:jQuery selector=".stable tr" event="mouseout"
                 query="jQuery(this).removeClass('active-row')"/>
    
</ui:composition>

